﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>

    <script src="~/js/vue.min.js"></script>
    <script src="~/js/axios.min.js"></script>
    <script src="~/js/qs.min.js"></script>
    <link href="~/js/Content/bootstrap.css" rel="stylesheet" />
    <title >新增财务</title>
</head>
<body>
    <div id="box" class="container">
        <table class="table table-bordered">
            <tr style="text-align:center">
                <td>部门</td>
                <td><input id="DeparMent " type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td>上月余额</td>
                <td><input id="PrvMounthPrice" type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td>总收入</td>
                <td><input id="Income " type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td>总支出</td>
                <td><input id="Expenditure" type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td>余额</td>
                <td><input id="Balance" type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td>经手人</td>
                <td><input id="PeopleHand" type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td>日期</td>
                <td><input id="StartTime" type="text" /></td>
            </tr>
            <tr style="text-align:center">
                <td><input id="Button1" type="button" value="保存" v-on:click="Add" /></td>
            </tr>
        </table>
    </div>
</body>
</html>
<script>
    new Vue({
        el: '#box',
        data() {
            
        },
        methods: {
            Add: function () {
                var s = {};
                alert(s);
                s.DeparMent = $("#DeparMent").val();
                s.PrvMounthPrice = $("#PrvMounthPrice").val();
                s.Income = $("#Income").val();
                s.Expenditure = $("#Expenditure").val();
                s.Balance = $("#Balance").val();
                s.PeopleHand = $("#PeopleHand").val();
                s.StartTime = $("#StartTime").val();
                axios
                    .post("/Finance/Add", window.Qs.stringify(s))
                    .then(
                        function (i) {
                            if (i.data > 0) {
                                alert("添加成功");
                                location.href = '/Finance/GetZongInfos';
                            }
                            else {
                                alert("添加失败");
                            }
                        }

                    )

            }       
        }
    })
</script>
